﻿using System;

//T007委托
namespace T007Commission
{
    public enum Language
    {
        Chinese,
        English
    };

    class Program
    {
        //tool method
        static void ChineseGreeting(string name)
        {
            Console.WriteLine("早上好，"+name);
        }
        static void EnglishGreeting(string name)
        {
            Console.WriteLine("Morning,"+name);
        }
        
        static void Main(string[] args)
        {
            /*
            GreetingDelegate delegate1 = new GreetingDelegate(ChineseGreeting);//Commission Variable
            //delegate1 = ChineseGreeting;//Bind first method
            delegate1 += EnglishGreeting;//Bind second method
            GreetPeople("卢",ChineseGreeting);
            GreetPeople("John",EnglishGreeting);
            GreetPeople("Bobo",delegate1);
            string key = Console.ReadLine();
            if(key.Equals("d"))
            {
                delegate1 -= ChineseGreeting;//Untie method
            }
            GreetPeople("Kangkang",delegate1);
            */
            
            GreetingManager gm =new GreetingManager();
            //GreetingDelegate delegate1;
            gm.delegate1 += EnglishGreeting; //Bind delegate method
            gm.delegate1 += ChineseGreeting;
            gm.GreetPeople("卢");
        }
    }
}
